﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using HaiPhuongDBTableAdapters;

public partial class BaiViet : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    public bool LayBaiVietMoiNhat(long madanhmuc)
    {
        BaiVietMoiNhatTableAdapter TinTuc = new BaiVietMoiNhatTableAdapter();
        DataTable baiviet = (DataTable)TinTuc.LayBaiVietMoiNhat(madanhmuc);
        if (baiviet.Rows.Count == 1)
        {
            tieude.InnerText = baiviet.Rows[0]["TieuDe"].ToString();
            noidung.InnerHtml = baiviet.Rows[0]["NoiDung"].ToString();
            return true;
        }
        return false;
    }

    public bool LayBaiViet(long mabaiviet)
    {
        BaiVietTableAdapter TinTuc = new BaiVietTableAdapter();
        DataTable baiviet = (DataTable)TinTuc.LayBaiViet(mabaiviet);
        if (baiviet.Rows.Count == 1)
        {
            tieude.InnerText = baiviet.Rows[0]["TieuDe"].ToString();
            noidung.InnerHtml = baiviet.Rows[0]["NoiDung"].ToString();
            return true;
        }
        return false;
    }
}
